package com.yinyong;

/**
 * Time    : 2023/3/18 20:04
 * Author  : 王摇摆
 * FileName: ValueTrans.java
 * Software: IntelliJ IDEA 2020.2.2
 * Blog    ：https://blog.csdn.net/weixin_44943389?type=blog
 */

/**
 * 本实例学习java中的经典值传递的思想
 * 实验：交换两个数值
 */
public class ValueTrans {
    public static void main(String[] args) {
        int a = 10;
        int b = 20;

        swap(a, b);

        System.out.println("the output of main function");
        System.out.println("The value of a is " + a);
        System.out.println("The value of b is " + b);

    }

    public static void swap(int a, int b) {
        int temp;
        temp = a;
        a = b;
        b = temp;

        System.out.println("the output of swap function");
        System.out.println("The value of a is " + a);
        System.out.println("The value of b is " + b);

    }
}
